#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "driver/gpio.h"
#include "xl9555.h"
#include "driver/i2s_std.h"
#include "esp_log.h"

#define XL9555_SDA  GPIO_NUM_10
#define XL9555_SCL  GPIO_NUM_11

#define TAG     "main"

void xl9555_button_callback(uint16_t num_io,int level)
{
    switch(num_io)
    {
        case IO0_1: 
            ESP_LOGI(TAG,"Button1 check,level:%d",level);
            break;
        case IO0_2: 
            ESP_LOGI(TAG,"Button2 check,level:%d",level);
            break;
        case IO0_3: 
            ESP_LOGI(TAG,"Button3 check,level:%d",level);
            break;
        case IO0_4: 
            ESP_LOGI(TAG,"Button4 check,level:%d",level);
            break;
        default:break;
    }
}


void i2c_and_xl9555_init(void)
{
    xl9555_init(XL9555_SDA,XL9555_SCL,GPIO_NUM_17,xl9555_button_callback);
    xl9555_ioconfig(0xFFFF);
}


void app_main(void)
{
    i2c_and_xl9555_init();
}
